<div class="panel panel-default">
	<div class="panel-heading"><i class="fa fa-fw fa-files-o"></i> <?php echo $page_title ?></div>
	<div class="panel-body">
		<?php foreach($post_edit as $post_rec): ?>
			<form action="<?php echo site_url("user/update_post/$post_rec[jonu_post_id]") ?>" method="post" enctype="multipart/form-data">
				<div class="post-col-bg">
					<label>Title</label>
					<input class="form-control input-sm" type="text" name="post_title" value="<?php echo $post_rec['jonu_post_title'] ?>"/>
					<label>Content</label>
					<textarea class="form-control input-sm" name="post_content" rows="10"><?php echo $post_rec['jonu_post_content'] ?></textarea>

					<?php  
					$this->db->join('jonu_post', 'jonu_pc.jonu_post_id = jonu_post.jonu_post_id');
					$this->db->join('jonu_category', 'jonu_pc.jonu_category_id = jonu_category.jonu_category_id');
					$this->db->where('jonu_pc.jonu_post_id', $this->uri->segment(3));
					$query = $this->db->get('jonu_pc');
					$result = $query->result_array();
					$cat_checker = array();
					for($i=0; $i<count($result); $i++){
						$cat_checker[] = $result[$i]['jonu_category_id'];
					}
					?>
					<label>Categories</label>
					<div id="usr-edit-cat">
						<?php $cat_num = 1 ?>
						<?php foreach($category as $cat_arr): ?>
							<?php if(in_array($cat_arr['jonu_category_id'], $cat_checker)): ?>
								<span><input name="cat_<?php echo $cat_num?>" type="checkbox" value="<?php echo $cat_arr['jonu_category_id'] ?>" checked="checked"> <?php echo $cat_arr['jonu_category_alias'] ?></span>
							<?php else: ?>
								<span><input name="cat_<?php echo $cat_num?>" type="checkbox" value="<?php echo $cat_arr['jonu_category_id'] ?>"> <?php echo $cat_arr['jonu_category_alias'] ?></span>
							<?php endif; ?>
							<?php $cat_num++ ?>
						<?php endforeach; ?>
					</div>
					<label>Photo</label>
					<input type="file" name="photo"/><br/>
					<input type="hidden" name="curr_photo" value="<?php echo $post_rec['jonu_post_image'] ?>" />			
					<img src="<?php echo base_url("asset/img/posts-image/$post_rec[jonu_post_image]") ?>" width="100"/><br/><br/>
				</div>
				<div class="post-col-sm">
					<label>Location</label>
					<fieldset class="fisarmonica">
						<div id="maps" style="margin-bottom: 10px;"></div>
						<div class="input_dinamici">			
							<span for="latitude"><input class="form-control input-sm" type="hidden" name="post_latitude" id="latitude" value="<?php echo $post_rec['jonu_post_latitude'] ?>" /></span>
							<span for="longitude"><input class="form-control input-sm" type="hidden" name="post_longitude" id="longitude" value="<?php echo $post_rec['jonu_post_longitude'] ?>" /></span>
						</div>
					</fieldset>
					<div for="address" name="post_location" class="input-group" style="margin-bottom: 10px;">
						<input type="text" class="form-control input-sm" name="post_location" id="address" placeholder="Type and hit search button" value="<?php echo $post_rec['jonu_post_location'] ?>" />
						<span class="input-group-btn">
							<button id="getmap" class="btn btn-sm btn-default" type="button"><i class="fa fa-search"></i></button>
						</span>
					</div>
				</div>
				<input type="submit" class="btn btn-sm btn-jonu" name="adm_btn_post_edit" value="Update Post"/>				
			</form>
		<?php endforeach; ?>
	</div>
</div>